Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@furystack/repository
Advanced tools
Repository implementation for FuryStack
You can set up a repository in the following way
class MyModel {
public id!: number
public value!: string
}
const myInjector = new Injector()
myInjector
.setupStores(stores => stores.addStore(new InMemoryStore({ model: MyModel, primaryKey: 'id' })))
.setupRepository(repo =>
repo.createDataSet(MyModel, {
onEntityAdded: ({ injector, entity }) => {
injector.logger.verbose({ message: `An entity added with value '${entity.value}'` })
},
authorizeUpdate: async () => ({
isAllowed: false,
message: 'This is a read only dataset. No update is allowed. :(',
}),
/** custom repository options */
}),
)
In the following example we've created a physical InMemory store for the model MyModel, and we've configured a Repository with a DataSet. It will log to a logger when an entity has been added and it won't allow us to update entities.
A DataSet is similar to a physical store, but it can have custom event callbacks and authorization logic. You can retrieve the dataset in a following way:
const dataSet = myInjector.getDataSetFor(MyModel)
dataSet.add(myInjector, { id: 1, value: 'foo' }) // <-- this will log to a logger
dataSet.update(myInjector, 1, { id: 1, value: 'bar' }) // <--- this one will be rejected
FAQs
Repository implementation for FuryStack
The npm package @furystack/repository receives a total of 56 weekly downloads. As such, @furystack/repository popularity was classified as not popular.
We found that @furystack/repository demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.